// JavaScript Document
		$(document).ready(function(){
			$('#main_nav li').find('.sub_nav').hide();
			$('#main_nav li').hover(function() {
				$(this).find('.sub_nav').fadeIn(10);
			}, function() {
				$(this).find('.sub_nav').fadeOut(10);
			});
		});
		//表格触碰颜色切换
$(document).ready(function(){
	$(".area_table tr").mouseover(function(){
     $(this).addClass("over");
    }).mouseout(function(){
     $(this).removeClass("over");
    })
});	
	

function openNewWin(owurl){
	var tmp=window.open("about:blank","","height=680, width=1040, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=yes, status=no");
	tmp.focus();
	tmp.location=owurl;
}

//地区切换选项
function Sha(ID){
for(i=0;i<22;i++){
 if(ID==i){
  abcz[ID].className='zkw_title_on';
  abcdz[ID].style.display='block';
 }
 else{
  abcz[i].className='zkw_title';
  abcdz[i].style.display='none';
 }
 }
} 

function openNewWin(owurl){
	var tmp=window.open("about:blank","","height=680, width=1040, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=yes, status=no");
	tmp.focus();
	tmp.location=owurl;
}

//tab切换
$(function() {
 function tt() {
 var td = $(this);
 var t = td.attr("id");
 var tds = td.parent("tr").find("td");
 var tables = td.parents("div:eq(0)");
 var table = tables.find("#div_" + t);
 tds.attr("className", "Lanmititle");
 td.attr("className", "Lanmititletihuan");
tables.find("div[id*=div_t]").css("display", "none");
 tables.find("#div_" + t).css("display", "block");
 }
 $(".Lanmititletihuan[id*=t]").mouseover(tt);
  $(".Lanmititle[id*=t]").mouseover(tt);
 });

//项目信息页tab
function labelBtn(showName,hiddenName1,hiddenName2,hiddenName3,num){
	var showLi = document.getElementsByTagName('li');
	for(var k = 0; k < showLi.length; k++){
		showLi[k].id = '';
	}
	showLi[num].id = 'current';
	
	var showTar = document.getElementsByTagName('tr');
	for(var i = 0; i < showTar.length; i++){
		if(showTar[i].className == showName){
			showTar[i].style.display = '';
		}if(showTar[i].className == hiddenName1){
			showTar[i].style.display = 'none';
		}if(showTar[i].className == hiddenName2){
			showTar[i].style.display = 'none';
		}if(showTar[i].className == hiddenName3){
			showTar[i].style.display = 'none';
		}
	}

}
function init(){
	labelBtn('jsgl','spxx','tdsp','kysp',0);
}

//下拉列表地区切换
function changeSubAreaList(target,objId){
	var opt = $('#'+objId).val();
	if(opt == '510000'){
		$("#"+target).empty();
	}
	eval("var cityList = p"+opt);
	$("#"+target).empty();
	$.each( cityList, function(i, city){
		$("#"+target).append("<option value='"+city[0]+"'>"+city[1]+"</option>");
	});
}

//下拉列表地区跳转
function changeIndexArea(target){
	var area = $('#'+target+"Area").val();
	var subArea = $('#'+target+"SubArea").val();
	var oldHref = window.location.href;
	var index = oldHref.lastIndexOf('index/');
	if(subArea==null || subArea==''){
		window.location.href = oldHref.substring(0, index+6)+area+"000";
	}else{
		window.location.href = oldHref.substring(0, index+6)+subArea+"000";
	}
}

function initCityList(target,tarCityVal){
	$.each( $('#'+target+' > option'), function(i, area){
		if( $(area).val().substring(0,4) == tarCityVal ){
			$(area).attr("selected","selected");
			return;
		}
	});
}

function initAreaList(target,tarAreaVal){
	$.each( $('#'+target+' > option'), function(i, area){
		if( $(area).val().substring(0,6) == tarAreaVal ){
			$(area).attr("selected","selected");
			return;
		}
	});
}

//平台检索地区切换
function comGetVillageDep(){
	$("#comDep").empty();
	$("#comDep").append("<option value=''>--部&nbsp;门--</option>");
  	$.get(baseUrl+"/department/getDepsForAdSearch/"+$("#comVillage").val(), function(data){
  	  	var deps = eval(data);
  		for(var j = 0; j < deps.length; j++){
			$("#comDep").append("<option value="+deps[j].depId+">"+deps[j].departmentName+"</option>");
		}
  	});
}
function comGetVillageNameAndDep(){
	$("#comVillage").empty();
	$("#comVillage").append("<option value=''>--县、区--</option>");
	eval("var city = p"+$("#comCity").val());
	  	for(var i = 0; i < city.length; i++){
	  		var _value = city[i][0];
			if($("#comVillageVal").val() && $("#comVillageVal").val() != '' && $("#comVillageVal").val() == _value){
				$("#comVillage").append("<option value="+city[i][0]+" selected='selected'>"+city[i][1]+"</option>");
			}else{
				$("#comVillage").append("<option value="+city[i][0]+">"+city[i][1]+"</option>");
			}
		}
	$("#comDep").empty();
	$("#comDep").append("<option value=''>--部&nbsp;门--</option>");
	var _comCityVal = $("#comCity").val();
	var _comVillage = $("#comVillage").val();
	var _code;
	if(_comVillage && _comVillage != ''){
		_code = _comVillage;
	}else{
		_code = _comCityVal;
	}
  	$.get(baseUrl+"/department/getDepsForAdSearch/"+_code, function(data){
  	  	var deps = eval(data);
  		for(var j = 0; j < deps.length; j++){
  			var _value = deps[j].depId;
			if($("#comDepVal").val() && $("#comDepVal").val() != '' && $("#comDepVal").val() == _value){
				$("#comDep").append("<option value="+deps[j].depId+" selected='selected'>"+deps[j].departmentName+"</option>");
			}else{
				$("#comDep").append("<option value="+deps[j].depId+">"+deps[j].departmentName+"</option>");
			}
		}
  	});
};
function perGetVillageDep(){
	$("#perDep").empty();
	$("#perDep").append("<option value=''>--部&nbsp;门--</option>");
  	$.get(baseUrl+"/department/getDepsForAdSearch/"+$("#perVillage").val(), function(data){
  	  	var deps = eval(data);
  		for(var j = 0; j < deps.length; j++){
			$("#perDep").append("<option value="+deps[j].depId+">"+deps[j].departmentName+"</option>");
		}
  	});
}
function perGetVillageNameAndDep(){
	$("#perVillage").empty();
	$("#perVillage").append("<option value=''>--县、区--</option>");
	eval("var city = p"+$("#perCity").val());
	  	for(var i = 0; i < city.length; i++){
	  		var _value = city[i][0];
			if($("#perVillageVal").val() && $("#perVillageVal").val() != '' && $("#perVillageVal").val() == _value){
				$("#perVillage").append("<option value="+city[i][0]+" selected='selected'>"+city[i][1]+"</option>");
			}else{
				$("#perVillage").append("<option value="+city[i][0]+">"+city[i][1]+"</option>");
			}
		}
	$("#perDep").empty();
	$("#perDep").append("<option value=''>--部&nbsp;门--</option>");
	var _perCityVal = $("#perCity").val();
	var _perVillage = $("#perVillage").val();
	var _code;
	if(_perVillage && _perVillage != ''){
		_code = _perVillage;
	}else{
		_code = _perCityVal;
	}
  	$.get(baseUrl+"/department/getDepsForAdSearch/"+_code, function(data){
  	  	var deps = eval(data);
  		for(var j = 0; j < deps.length; j++){
  			var _value = deps[j].depId;
			if($("#perDepVal").val() && $("#perDepVal").val() != '' && $("#perDepVal").val() == _value){
				$("#perDep").append("<option value="+deps[j].depId+" selected='selected'>"+deps[j].departmentName+"</option>");
			}else{
				$("#perDep").append("<option value="+deps[j].depId+">"+deps[j].departmentName+"</option>");
			}
		}
  	});
};
function proGetVillageDep(){
	$("#proDep").empty();
	$("#proDep").append("<option value=''>--部&nbsp;门--</option>");
  	$.get(baseUrl+"/department/getDepsForAdSearch/"+$("#proVillage").val(), function(data){
  	  	var deps = eval(data);
  		for(var j = 0; j < deps.length; j++){
			$("#proDep").append("<option value="+deps[j].depId+">"+deps[j].departmentName+"</option>");
		}
  	});
}

function proGetVillageNameAndDep(){
	$("#proVillage").empty();
	$("#proVillage").append("<option value=''>--县、区--</option>");
	if($("#proCity").val() == ""){
    	return;
	}
	eval("var city = p"+$("#proCity").val());
	  	for(var i = 0; i < city.length; i++){
	  		var _value = city[i][0];
			if($("#proVillageVal").val() && $("#proVillageVal").val() != '' && $("#proVillageVal").val() == _value){
				$("#proVillage").append("<option value="+city[i][0]+" selected='selected'>"+city[i][1]+"</option>");
			}else{
				$("#proVillage").append("<option value="+city[i][0]+">"+city[i][1]+"</option>");
			}
		}
	$("#proDep").empty();
	$("#proDep").append("<option value=''>--部&nbsp;门--</option>");
	var _proCityVal = $("#proCity").val();
	var _proVillage = $("#proVillage").val();
	var _code;
	if(_proVillage && _proVillage != ''){
		_code = _proVillage;
	}else{
		_code = _proCityVal;
	}
  	$.get(baseUrl+"/department/getDepsForAdSearch/"+_code, function(data){
  	  	var deps = eval(data);
  		for(var j = 0; j < deps.length; j++){
  			var _value = deps[j].depId;
			if($("#proDepVal").val() && $("#proDepVal").val() != '' && $("#proDepVal").val() == _value){
				$("#proDep").append("<option value="+deps[j].depId+" selected='selected'>"+deps[j].departmentName+"</option>");
			}else{
				$("#proDep").append("<option value="+deps[j].depId+">"+deps[j].departmentName+"</option>");
			}
		}
  	});
};

function bevGetVillageDep(){
	$("#bevDep").empty();
	$("#bevDep").append("<option value=''>--部&nbsp;门--</option>");
  	$.get(baseUrl+"/department/getDepsForAdSearch/"+$("#bevVillage").val(), function(data){
  	  	var deps = eval(data);
  		for(var j = 0; j < deps.length; j++){
			$("#bevDep").append("<option value="+deps[j].depId+">"+deps[j].departmentName+"</option>");
		}
  	});
}
function bevGetVillageNameAndDep(){
	$("#bevVillage").empty();
	$("#bevVillage").append("<option value=''>--县、区--</option>");
	eval("var city = p"+$("#bevCity").val());
	  	for(var i = 0; i < city.length; i++){
	  		var _value = city[i][0];
			if($("#bevVillageVal").val() && $("#bevVillageVal").val() != '' && $("#bevVillageVal").val() == _value){
				$("#bevVillage").append("<option value="+city[i][0]+" selected='selected'>"+city[i][1]+"</option>");
			}else{
				$("#bevVillage").append("<option value="+city[i][0]+">"+city[i][1]+"</option>");
			}
		}
	$("#bevDep").empty();
	$("#bevDep").append("<option value=''>--部&nbsp;门--</option>");
	var _bevCityVal = $("#bevCity").val();
	var _bevVillage = $("#bevVillage").val();
	var _code;
	if(_bevVillage && _bevVillage != ''){
		_code = _bevVillage;
	}else{
		_code = _bevCityVal;
	}
  	$.get(baseUrl+"/department/getDepsForAdSearch/"+_code, function(data){
  	  	var deps = eval(data);
  		for(var j = 0; j < deps.length; j++){
  			var _value = deps[j].depId;
			if($("#bevDepVal").val() && $("#bevDepVal").val() != '' && $("#bevDepVal").val() == _value){
				$("#bevDep").append("<option value="+deps[j].depId+" selected='selected'>"+deps[j].departmentName+"</option>");
			}else{
				$("#bevDep").append("<option value="+deps[j].depId+">"+deps[j].departmentName+"</option>");
			}
		}
  	});
};

var p510000 = [];
function initAdSearchPro(){
	//项目高级搜索
    if($("#proCityVal").val() && $("#proCityVal").val() != '' && $("#proCityVal").val() == '510000'){
    	$("#proCity").empty();
    	$("#proCity").append("<option value='510000' selected='selected'>省级</option>");
    	proGetVillageNameAndDep();
    }
     	for(var i = 0; i < provinceArr.length; i++){
      	var _value = provinceArr[i][0];
    	if($("#proCityVal").val() && $("#proCityVal").val() != '' && $("#proCityVal").val() == _value){
    		$("#proCity").append("<option value="+provinceArr[i][0]+" selected='selected'>"+provinceArr[i][1]+"</option>");
    		proGetVillageNameAndDep();
    	}else{
    		$("#proCity").append("<option value="+provinceArr[i][0]+">"+provinceArr[i][1]+"</option>");
    	}
    }
}
function initAdSearchCom(){
	 //企业高级搜索
    if($("#comCityVal").val() && $("#comCityVal").val() != '' && $("#comCityVal").val() == '510000'){
    	$("#comCity").empty();
    	$("#comCity").append("<option value='510000' selected='selected'>省级</option>");
    	comGetVillageNameAndDep();
    }
     	for(var i = 0; i < provinceArr.length; i++){
      	var _value = provinceArr[i][0];
    	if($("#comCityVal").val() && $("#comCityVal").val() != '' && $("#comCityVal").val() == _value){
    		$("#comCity").append("<option value="+provinceArr[i][0]+" selected='selected'>"+provinceArr[i][1]+"</option>");
    		comGetVillageNameAndDep();
    	}else{
    		$("#comCity").append("<option value="+provinceArr[i][0]+">"+provinceArr[i][1]+"</option>");
    	}
    }
}
function initAdSearchPer(){
	 //人员高级搜索
    if($("#perCityVal").val() && $("#perCityVal").val() != '' && $("#perCityVal").val() == '510000'){
    	$("#perCity").empty();
    	$("#perCity").append("<option value='510000' selected='selected'>省级</option>");
    	perGetVillageNameAndDep();
    }
     	for(var i = 0; i < provinceArr.length; i++){
      	var _value = provinceArr[i][0];
    	if($("#perCityVal").val() && $("#perCityVal").val() != '' && $("#perCityVal").val() == _value){
    		$("#perCity").append("<option value="+provinceArr[i][0]+" selected='selected'>"+provinceArr[i][1]+"</option>");
    		perGetVillageNameAndDep();
    	}else{
    		$("#perCity").append("<option value="+provinceArr[i][0]+">"+provinceArr[i][1]+"</option>");
    	}
    }
}
function initAdSearchBev(){
 	//行为高级搜索
    if($("#bevCityVal").val() && $("#bevCityVal").val() != '' && $("#bevCityVal").val() == '510000'){
    	$("#bevCity").empty();
    	$("#bevCity").append("<option value='510000' selected='selected'>省级</option>");
    	bevGetVillageNameAndDep();
    }
     	for(var i = 0; i < provinceArr.length; i++){
      	var _value = provinceArr[i][0];
    	if(("#bevCityVal$").val() && ("#bevCityVal$").val() != '' && ("#bevCityVal$").val() == _value){
    		$("#bevCity").append("<option value="+provinceArr[i][0]+" selected='selected'>"+provinceArr[i][1]+"</option>");
    		bevGetVillageNameAndDep();
    	}else{
    		$("#bevCity").append("<option value="+provinceArr[i][0]+">"+provinceArr[i][1]+"</option>");
    	}
    }
     
}